home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekgen!tekred!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v06i095: conquer4 - middle earth multi-player game (V4), Part13/14
- Message-ID: <4153@tekred.CNA.TEK.COM>
- Date: 24 Jun 89 16:37:30 GMT
- Sender: news@tekred.CNA.TEK.COM
- Lines: 1597
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: adb@bu-it.bu.edu (Adam Bryant)
- Posting-number: Volume 6, Issue 95
- Archive-name: conquer4/Part13
- Superseeds: conquer3; Volume 4, Issue 42-49
-
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 13 (of 14)."
- # Contents: data.c forms.c header.h txt0
- # Wrapped by billr@saab on Thu Jun 15 15:20:22 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'data.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'data.c'\"
- else
- echo shar: Extracting \"'data.c'\" \(8567 characters\)
- sed "s/^X//" >'data.c' <<'END_OF_FILE'
- X/*conquer : Copyright (c) 1988 by Ed Barlow.
- X * I spent a long time writing this code & I hope that you respect this.
- X * I give permission to alter the code, but not to copy or redistribute
- X * it without my explicit permission. If you alter the code,
- X * please document changes and send me a copy, so all can have it.
- X * This code, to the best of my knowledge works well, but it is my first
- X * 'C' program and should be treated as such. I disclaim any
- X * responsibility for the codes actions (use at your own risk). I guess
- X * I am saying "Happy gaming", and am trying not to get sued in the process.
- X * Ed
- X */
- X
- X#include "header.h"
- X#include "data.h"
- X
- X/* ele is display characters */
- Xchar *ele= "~#^%-0";
- X
- X/* Movement costs for varying types of terain by race - '/'=error */
- Xchar *HElecost= "//521/";
- Xchar *OElecost= "//222/";
- Xchar *EElecost= "//631/";
- Xchar *DElecost= "//311/";
- Xchar *FElecost= "16211/"; /* flight costs */
- X
- X/* BELOW ARE MOVEMENT COSTS FOR VEG */
- Xchar *veg= "vdtblgwfjsi~0";
- Xchar *HVegcost= "63210001332//"; /* Human */
- Xchar *OVegcost= "43100022527//"; /* Orcs */
- Xchar *EVegcost= "86221000027//"; /* Elves */
- Xchar *DVegcost= "47100013577//"; /* Dwarves */
- Xchar *FVegcost= "410000001000/"; /* Flight */
- Xchar *vegfood= "0004697400000"; /* food value given veg */
- X
- Xchar *des= "tcmfx$!&sC?lb+*g=u-P0";
- X#ifdef CONQUER
- Xchar *elename[]= { "WATER","PEAK", "MOUNTAIN", "HILL", "FLAT","ERROR"};
- Xchar *vegname[]= { "VOLCANO", "DESERT", "TUNDRA", "BARREN", "LT VEG",
- X"GOOD", "WOOD", "FOREST", "JUNGLE", "SWAMP", "ICE", "NONE"};
- Xchar *desname[]= {"TOWN", "CITY", "MINE", "FARM", "DEVASTATED", "GOLDMINE",
- X"FORT","RUIN","STOCKADE","CAPITOL","SPECIAL","LUMBERYD","BLKSMITH","ROAD",
- X"MILL","GRANARY","CHURCH","UNIVERSITY","NODESIG","BASE CAMP","ERROR"};
- Xchar *races[]= { "GOD","ORC","ELF","DWARF","LIZARD",
- X"HUMAN","PIRATE","SAVAGE","NOMAD","UNKNOWN"};
- Xchar *diploname[]= { "UNMET", "TREATY", "ALLIED", "FRIENDLY",
- X"NEUTRAL", "HOSTILE", "WAR", "JIHAD"};
- Xchar *soldname[]= { "?","MARCH","SCOUT","GARRISON","TRADED","MILITIA",
- X "FLYING","DEFEND","MAG_DEF","ATTACK","MAG_ATT","GENERAL","SORTIE",
- X "SIEGE","BESIEGED","ON_BOARD","RULE"};
- X#endif CONQUER
- X
- Xchar *directions[]= { "here", "north", "northeast", "east", "southeast",
- X "south", "southwest", "west", "northwest"};
- Xchar *Class[]= { "NPC", "king", "emperor", "wizard", "priest", "pirate",
- X"trader", "warlord", "demon", "dragon", "shadow"};
- Xchar *allignment[]= { "","Good","Neutral","Evil","Other" };
- X
- Xchar *unittype[]= {
- X"Militia", "Goblins", "Orcs", "Infantry", "Sailors", "Marines", "Archers",
- X"Uruk-Hai", "Ninjas", "Phalanx", "Olog-Hai", "Legionaries", "Dragoons", "Mercenaries",
- X"Trolls", "Elite", "Lt_Cavalry", "Hv_Cavalry", "Catapults", "Siege", "Rocs",
- X"Knights", "Gryfins","Elephants","Zombies","Spy","Scout",
- X"King","Baron","Emperor","Prince","Wizard","Mage",
- X"Pope","Bishop","Admiral","Captain","Warlord","Lord",
- X"Demon","Devil","Dragon","Wyrm","Shadow","Nazgul",
- X"Spirit", "Assasin", "Efreet", "Gargoyle", "Wraith",
- X"Hero", "Centaur", "Giant", "Superhero", "Mummy",
- X"Elemental", "Minotaur", "Demon", "Balrog", "Dragon"
- X};
- X
- X#ifdef CONQUER
- X/*short unit types...for printing in upper right corner*/
- Xchar *shunittype[]= {
- X"mlta", "Gob", "Orc", "Inf", "Sail", "XMar", "Arch",
- X"Uruk", "Ninj", "Phax", "olog", "Legn", "Drag", "Merc",
- X"Trol", "Elt", "lCav", "hCav", "cat", "sge", "Roc",
- X"Kni", "grif","ele","zom","Spy","Scout",
- X"King","Bar","Emp","Prin","Wizd","Magi",
- X"Apos","Bish","Admi","Capt","Warl","Lord",
- X"Demn","Devl","Drag","Wyrm","Shad","Nazg",
- X"spir", "Assn", "efr", "Garg", "Wra",
- X"Hero", "Cent", "gt", "Shro", "Mumm",
- X"Elem", "mino", "dem", "Bal", "Drag"
- X};
- X#endif CONQUER
- Xint unitminsth[]= /* min strength of a unit */
- X{
- X1, 1, 1, 1, 1, 1, 1,
- X1, 1, 1, 1, 1, 1, 1,
- X1, 1, 1, 1, 1, 1, 1,
- X1, 1, 1, 1, 1, 1,
- X100,50,100,50,250,50,
- X100,50,100,50,250,125,
- X250,50,500,100,250,125,
- X50, 50, 50, 75, 75,
- X100, 50, 150, 150, 150,
- X175, 150, 500, 500, 1000
- X};
- X
- Xint unitattack[]=
- X{ -40, -15, 0, 0, 0, 5, 0,
- X5, 20, 10, 15, 20, 10, 0,
- X25, 20, 20, 30, -20, -20, 20,
- X40, 40, 50, -15, -30, -30,
- X30,20,30,20,30,20,
- X30,20,30,20,30,30,
- X50,20,50,40,50,40,
- X0, 20, 10, 10, 10,
- X0, 10, 0, 15, 15,
- X5, 20, 50, 40, 50
- X};
- Xint unitdefend[]=
- X{
- X-25, -15, 0, 0, 0, 0, 10,
- X5, 0, 10, 15, 20, 10, 0,
- X15, 20, 20, 30, 20, 20, 30,
- X40, 50, 50, -15, -30, -30,
- X30,20,30,20,30,20,
- X30,20,30,20,30,30,
- X50,20,50,40,50,40,
- X0, 20, 10, 10, 10,
- X0, 10, 0, 15, 15,
- X5, 20, 50, 40, 50
- X};
- X/*ten times the move rate of a unit*/
- Xint unitmove[]=
- X{
- X 0, 10, 10, 10, 0, 0, 10,
- X10, 10, 10, 10, 10, 20, 10,
- X10, 13, 20, 20, 5, 5, 10,
- X20, 15, 5, 10, 10, 20,
- X20,20,20,20,20,20,
- X20,20,20,20,20,20,
- X20,20,20,20,20,20,
- X10, 10, 15, 10, 10,
- X10, 15, 10, 10, 10,
- X15, 10, 10, 15, 20
- X};
- X/*metal cost of a unit*/
- Xint u_enmetal[]=
- X{
- X 0, 80, 80, 100, 100, 100, 100,
- X150, 150, 150, 150, 150, 100, 0,
- X200, 200, 100, 300,1000,1000, 300,
- X600, 400, 600, 100, 0, 0,
- X0,0,0,0,0,0,
- X0,0,0,0,0,0,
- X0,0,0,0,0,0,
- X0, 0, 0, 0, 0,
- X0, 0, 0, 0, 0,
- X0, 0, 0, 0, 0
- X};
- X/*enlist cost for a unit*/
- Xint u_encost[]=
- X{
- X 50, 70, 85, 100, 100, 100, 100, /* gold cost for enlistment */
- X 125, 125, 150, 180, 180, 300, 225,
- X 225, 225, 300, 450, 600, 600, 600,
- X 600, 800, 600, 100, 10000, 100,
- X0,0,0,0,0,0,
- X0,0,0,0,0,0,
- X0,0,0,0,0,0,
- X2, 2, 2, 2, 2, /* spell points for enlistment */
- X2, 2, 5, 5, 5,
- X5, 5,10,10,15
- X};
- X/*maintenance cost for a unit*/
- Xint unitmaint[]= {
- X 20, 20, 50, 50, 50, 50, 50,
- X 50, 50, 50, 75, 75, 200, 100,
- X100, 100, 175, 225, 250, 250, 250,
- X250, 250, 250, 0, 2000, 100,
- X0,0,0,0,0,0, /* GOLD COST PER EQUIVALENT MAN FOR MONSTERS */
- X0,0,0,0,0,0,
- X0,0,0,0,0,0,
- X1000, 400, 400, 450, 450, /* JEWELS / TURN COST FOR ENTIRE UNIT */
- X200, 200, 2100, 450, 1000, /* MULTIPLY BY 5 FOR GOLD COST FOR UNIT */
- X1900, 2100, 6000, 6000, 10000
- X};
- X
- Xchar *exefile = "exec";
- Xchar *datafile = "data";
- Xchar *msgfile = "mesg";
- Xchar *sortname = "conqsort";
- X
- X#ifdef ADMIN
- Xchar scenario[NAMELTH+1];
- Xchar *npcsfile = "nations";
- X#endif ADMIN
- Xchar *helpfile = "help";
- Xchar *newsfile = "news";
- Xchar *isonfile = "lock";
- X#ifdef TRADE
- Xchar *tradefile = "commerce";
- X#endif TRADE
- X
- Xchar *seasonstr[] = { "Winter", "Spring", "Summer", "Fall" };
- X
- Xchar *pwrname[] = {
- X"WARRIOR", "CAPTAIN", "WARLORD", "ARCHER", "CAVALRY", "SAPPER",
- X"ARMOR", "AVIAN", "MI_MONST", "AV_MONST", "MA_MONST",
- X
- X"SLAVER", "DERVISH", "HIDDEN", "ARCHITECT", "RELIGION", "MINER",
- X"BREEDER", "URBAN", "STEEL", "NINJA", "SAILOR", "DEMOCRACY", "ROADS",
- X
- X"THE_VOID", "KNOWALL", "DESTROYER", "VAMPIRE",
- X"SUMMON", "WYZARD", "SORCERER", "ERROR"
- X};
- X
- Xlong powers[] = {
- X WARRIOR, /*MILITARY POWERS => START=0*/
- X CAPTAIN, /*1*/
- X WARLORD, /*2*/
- X ARCHER, /*3*/
- X CAVALRY, /*4*/
- X SAPPER, /*5*/
- X ARMOR, /*6*/
- X AVIAN, /*7*/
- X MI_MONST, /*8*/
- X AV_MONST, /*9*/
- X MA_MONST, /*10th power; Mil power #11*/
- X SLAVER, /*CIVILIAN POWERS => START=11*/
- X DERVISH, /*12*/
- X HIDDEN, /*13*/
- X ARCHITECT, /*14*/
- X RELIGION, /*15*/
- X MINER, /*16*/
- X BREEDER, /*17*/
- X URBAN, /*18*/
- X STEEL, /*19*/
- X NINJA, /*20*/
- X SAILOR, /*21*/
- X DEMOCRACY, /*22*/
- X ROADS, /* 13th CIVILIAN POWER (23rd total) */
- X THE_VOID, /* MAGICAL SKILLS => START=24 */
- X KNOWALL, /*25*/
- X DESTROYER, /*26*/
- X VAMPIRE, /*27*/
- X SUMMON, /*28*/
- X WYZARD, /*29*/
- X SORCERER, /*30th Entry => 31 total powers => End=7*/
- X 0
- X};
- X
- XFILE *fnews, *fopen();
- Xstruct sprd_sht spread;
- X
- XFILE *fm;
- Xint mailok=FALSE;
- X
- X#ifdef CONQUER
- X#ifdef SYSMAIL
- Xchar sysmail[100];
- Xint sys_mail_status;
- X#endif SYSMAIL
- Xchar conqmail[100];
- Xint conq_mail_status;
- X#endif CONQUER
- X
- X/* trade good value - zeroes in this comment line mark increments of ten*/
- X/* 0 0 0 0 0 0 */
- X/* a value of x means any designation is possible */
- X/* fwbcwmhpgcfshfrwdpbcpstgponpmldpllpiopshmtpbcltismasspdsgridp*/
- Xchar *tg_stype="xffffttttffffffffffftxlxllttuuctcccfffxxtccmmmmmmmm$$$$$$$$$$0";
- Xchar *tg_value="13335157911433442331131135734567789123937571111111111111111110";
- X
- Xchar *tg_name[] = {
- X"furs", "wool", "beer", "cloth", "wine",
- X"mules", "horses", "pigeons", "griffons",
- X"corn", "fish", "sugar", "honey", "fruit",
- X"rice", "wheat", "dairy", "peas", "bread", "cereal",
- X"pottery", "salt", "timber", "granite", "pine", "oak", "nails",
- X"papyrus","math","library","drama","paper","literature","law","philosophy",
- X"irregation", "oxen", "plows",
- X"stones",
- X"herbs", "medicine",
- X"torture", "prison",
- X"bronze", "copper", "lead", "tin", "iron","steel", "mithral", "adamantine",
- X"spice","silver","pearls","dye","silk","gold","rubys","ivory","diamonds","platinum",
- X"none"
- X};
- END_OF_FILE
- if test 8567 -ne `wc -c <'data.c'`; then
- echo shar: \"'data.c'\" unpacked with wrong size!
- fi
- # end of 'data.c'
- fi
- if test -f 'forms.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'forms.c'\"
- else
- echo shar: Extracting \"'forms.c'\" \(26241 characters\)
- sed "s/^X//" >'forms.c' <<'END_OF_FILE'
- X/*conquer : Copyright (c) 1988 by Ed Barlow.
- X * I spent a long time writing this code & I hope that you respect this.
- X * I give permission to alter the code, but not to copy or redistribute
- X * it without my explicit permission. If you alter the code,
- X * please document changes and send me a copy, so all can have it.
- X * This code, to the best of my knowledge works well, but it is my first
- X * 'C' program and should be treated as such. I disclaim any
- X * responsibility for the codes actions (use at your own risk). I guess
- X * I am saying "Happy gaming", and am trying not to get sued in the process.
- X * Ed
- X */
- X
- X/* screen subroutines */
- X
- X#include <ctype.h>
- X#include "header.h"
- X#include "data.h"
- X
- Xextern FILE *fexe, *fnews;
- Xextern short country,redraw;
- Xextern long startgold;
- X
- Xstatic char helplist[MAXHELP][20]={"Commands", "General Info",
- X "Military","Magic","Designations","Other"};
- X
- X#define RPT_LINES 14
- X#define RPT_COLS 13
- X#define BUF_LINES 10
- X#define BUF_COLS 15
- X#define MAXINROW ((COLS-BUF_COLS)/RPT_COLS)
- X#define MAXINSCR (((LINES-BUF_LINES)/RPT_LINES)*MAXINROW)
- Xvoid
- Xshowscore()
- X{
- X int i;
- X int done=FALSE;
- X int xpos,ypos;
- X int count,count2; /*number of time through the loop on this screen*/
- X int nationid; /*current nation id */
- X
- X count2=1;
- X while(done==FALSE) {
- X clear();
- X standout();
- X mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN");
- X standend();
- X
- X nationid=count2;
- X xpos=BUF_COLS;
- X ypos=3;
- X count=0;
- X while((nationid<NTOTAL)&&(count<MAXINSCR)){
- X if((nationid<NTOTAL)
- X &&(isntn(ntn[nationid].active))) {
- X if (count%MAXINROW==0) {
- X /* display header information */
- X mvaddstr(ypos,0,"nationid is:");
- X mvaddstr(ypos+1,0,"name is:");
- X mvaddstr(ypos+2,0,"leader:");
- X mvaddstr(ypos+3,0,"race:");
- X mvaddstr(ypos+4,0,"class:");
- X mvaddstr(ypos+5,0,"alignment:");
- X mvaddstr(ypos+6,0,"score:");
- X mvaddstr(ypos+7,0,"talons:");
- X mvaddstr(ypos+8,0,"military:");
- X mvaddstr(ypos+9,0,"civilians:");
- X mvaddstr(ypos+10,0,"sectors:");
- X mvaddstr(ypos+11,0,"npc nation:");
- X }
- X
- X /* display nation information */
- X mvprintw(ypos,xpos,"%d",nationid);
- X standout();
- X mvprintw(ypos+1,xpos,"%s",ntn[nationid].name);
- X standend();
- X mvprintw(ypos+2,xpos,"%s",ntn[nationid].leader);
- X for(i=1;i<8;i++)
- X if(ntn[nationid].race==*(races+i)[0])
- X mvprintw(ypos+3,xpos,"%s",*(races+i));
- X mvprintw(ypos+4,xpos,"%s",*(Class+ntn[nationid].class));
- X mvprintw(ypos+5,xpos,"%s",allignment[npctype(ntn[nationid].active)]);
- X mvprintw(ypos+6,xpos,"%ld",ntn[nationid].score);
- X mvprintw(ypos+7,xpos,"%ld",ntn[nationid].tgold);
- X mvprintw(ypos+8,xpos,"%ld",ntn[nationid].tmil);
- X mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tciv);
- X mvprintw(ypos+10,xpos,"%d",ntn[nationid].tsctrs);
- X if(isnpc(ntn[nationid].active))
- X mvprintw(ypos+11,xpos,"Yes");
- X else mvprintw(ypos+11,xpos,"No");
- X count++;
- X if(count<MAXINSCR && count%MAXINROW==0) {
- X ypos+=RPT_LINES;
- X xpos=BUF_COLS;
- X } else {
- X xpos+=RPT_COLS;
- X }
- X }
- X nationid++;
- X }
- X standout();
- X mvaddstr(LINES-6,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
- X mvaddstr(LINES-5,(COLS/2)-9,"HIT SPACE IF DONE");
- X standend();
- X refresh();
- X if (getch()==' ') done=TRUE;
- X else {
- X /* go to start of next page in list */
- X while(nationid<NTOTAL && !isntn(ntn[nationid].active))
- X nationid++;
- X if(nationid==NTOTAL) count2=1;
- X else count2=nationid;
- X }
- X }
- X}
- X
- X#define MAXINCOL (LINES-10)
- X#define MAXONSCR (MAXINCOL*(COLS/40))
- Xvoid
- Xdiploscrn()
- X{
- X int i,j;
- X char k,name[20];
- X short nation, offset, count, count2, temp;
- X short isgod=FALSE;
- X long bribecost;
- X if(country==0) {
- X isgod=TRUE;
- X if (get_god()) return;
- X }
- X count2=1;
- X while(1){
- X count=1;
- X offset=0;
- X clear();
- X standout();
- X mvaddstr(0,(COLS/2)-12,"NATION DIPLOMACY SUMMARY");
- X standend();
- X mvaddstr(2,0," BY YOU, TO YOU");
- X for(i=count2;i<NTOTAL && count<MAXONSCR;i++)
- X if((isntnorp(ntn[i].active))&&(i!=country)) {
- X if(count%MAXINCOL==0) {
- X offset+=40;
- X mvaddstr(2,offset," BY YOU, TO YOU");
- X count++;
- X }
- X mvprintw(count%MAXINCOL+2,offset, "%d. %s",i,ntn[i].name);
- X if((curntn->dstatus[i]==WAR)
- X ||(curntn->dstatus[i]==JIHAD)) standout();
- X mvprintw(count%MAXINCOL+2,offset+14, "=> %s",*(diploname+curntn->dstatus[i]));
- X standend();
- X if((ntn[i].dstatus[country]==WAR)
- X ||(ntn[i].dstatus[country]==JIHAD)) standout();
- X mvprintw(count%MAXINCOL+2,offset+28, "=> %s",*(diploname+ntn[i].dstatus[country]));
- X standend();
- X count++;
- X }
- X
- X /* display options */
- X standout();
- X mvaddstr(LINES-7,0,"HIT RETURN KEY TO CHANGE STATUS; HIT SPACE IF DONE");
- X mvprintw(LINES-6,0,"HIT 'B' KEY TO BRIBE NPC NATION (cost=$%ld per 1000 Mil.)",BRIBE);
- X mvaddstr(LINES-5,0,"ANY OTHER KEY TO CONTINUE:");
- X standend();
- X refresh();
- X k=getch();
- X if(k==' ') {
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X if((k!='B')&&(k!='\r')&&(k!='\n')) {
- X /* find start for next listing */
- X for(; i<NTOTAL && (!isntnorp(ntn[i].active)||i==country); i++) ;
- X if(i==NTOTAL) count2=1;
- X else count2=i;
- X continue;
- X }
- X if(k=='B'){
- X if(curntn->tgold<=BRIBE){
- X mvaddstr(LINES-3,0,"NOT ENOUGH GOLD");
- X refresh();
- X getch();
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X mvaddstr(LINES-4,0,"BRIBES DONT ALWAYS WORK (only the update will show)");
- X mvaddstr(LINES-3,0,"WHAT NATION:");
- X refresh();
- X nation = get_country();
- X
- X /* may only change with NPCs */
- X if((nation<=0)
- X ||(nation>=NTOTAL)
- X ||(!isnpc(ntn[nation].active))){
- X errormsg("NOT NON PLAYER COUNTRY");
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X if(ntn[country].dstatus[nation]==UNMET){
- X errormsg("YOU HAVE NOT MET COUNTRY");
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X if((isgod!=TRUE)
- X &&((ntn[nation].dstatus[country]==ALLIED)
- X ||(ntn[nation].dstatus[country]==JIHAD)
- X ||(ntn[nation].dstatus[country]==UNMET)
- X ||(ntn[nation].dstatus[country]==TREATY))){
- X errormsg("Sorry, you can't bribe them");
- X return;
- X }
- X
- X if( isgod==TRUE ) {
- X bribecost = 0;
- X } else if( ntn[nation].tmil > 1000 ) {
- X bribecost = BRIBE * ntn[nation].tmil / 1000;
- X } else bribecost = BRIBE;
- X mvprintw(LINES-3,0,"This will cost %ld gold talons. continue (y or n)",bribecost);
- X refresh();
- X
- X if( getch() != 'y' ) return;
- X if(curntn->tgold<=bribecost){
- X errormsg("Sorry Not Enough Gold");
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X curntn->tgold-=bribecost;
- X
- X sprintf(name,"%s%d",exefile,nation);
- X if ((fm=fopen(name,"a+"))==NULL) {
- X printf("error opening news file\n");
- X exit(FAIL);
- X }
- X BRIBENATION;
- X mailclose();
- X
- X ntn[nation].dstatus[country]--;
- X
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X mvaddstr(LINES-3,0,"WHAT NATION:");
- X refresh();
- X nation = get_country();
- X /* can't change with nomads...*/
- X if((nation<=0)||(nation>NTOTAL)||(!isntnorp(ntn[nation].active))){
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X if((isgod==FALSE)
- X &&(curntn->tgold < BREAKJIHAD )
- X &&(((curntn->dstatus[nation]==TREATY)
- X &&(ntn[nation].dstatus[country]<WAR))
- X ||(curntn->dstatus[nation]==JIHAD))) {
- X
- X mvprintw(LINES-1,0,"Sorry, need %d talons to change status with ntn %s",BREAKJIHAD,ntn[nation].name);
- X clrtoeol();
- X mvaddstr(LINES-1, 60, "PRESS ANY KEY");
- X refresh();
- X getch();
- X if(isgod==TRUE) reset_god();
- X return;
- X } else if (isgod==FALSE && curntn->dstatus[nation]==UNMET) {
- X errormsg("Sorry, you have not met that nation yet.");
- X if(isgod==TRUE) reset_god();
- X return;
- X } else {
- X clear();
- X mvaddstr(0,0,"WHAT NEW STATUS");
- X j=2;
- X mvprintw(j++,0,"1) TREATY (%d talons to break)",BREAKJIHAD);
- X mvaddstr(j++,0,"2) ALLIED");
- X mvaddstr(j++,0,"3) FRIENDLY");
- X mvaddstr(j++,0,"4) NEUTRAL");
- X mvaddstr(j++,0,"5) HOSTILE");
- X mvaddstr(j++,0,"6) WAR");
- X mvprintw(j++,0,"7) JIHAD (%d talons to break):",BREAKJIHAD);
- X j++;
- X for( i=1; i<=NTOTAL; i++ )
- X if((isntnorp(ntn[i].active)) && (ntn[nation].dstatus[i]==TREATY))
- X mvprintw(j++,10,"%s has treaty with %s",ntn[nation].name,ntn[i].name);
- X
- X j++;
- X mvaddstr(j++,0,"INPUT:");
- X refresh();
- X temp = get_number();
- X if((temp<=UNMET)||(temp>JIHAD)
- X ||((isgod==FALSE)&&(temp==UNMET))){
- X mvprintw(23,0,"SORRY, Invalid inputs -- hit return");
- X refresh();
- X getch();
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X
- X if(((curntn->dstatus[nation]==TREATY)&&(temp!=TREATY))
- X ||(( curntn->dstatus[nation]==JIHAD)&&(temp!=JIHAD)))
- X curntn->tgold -= BREAKJIHAD;
- X
- X curntn->dstatus[nation]=temp;
- X EADJDIP(country,nation);
- X
- X if((temp>HOSTILE)
- X &&(ispc(ntn[nation].active))
- X &&(ntn[nation].dstatus[country]<WAR)) {
- X mailopen(nation);
- X fprintf(fm,"Message to %s from CONQUER\n",ntn[nation].name);
- X fprintf(fm," During the %s of Year %d,\n",PSEASON(TURN),YEAR(TURN));
- X fprintf(fm," %s declared war on you\n",curntn->name);
- X mailclose();
- X }
- X
- X /*prevent ron from being sneaky*/
- X if((temp>HOSTILE)
- X &&(isactive(ntn[nation].active))
- X &&(ntn[nation].dstatus[country]<WAR)) {
- X ntn[nation].dstatus[country]=WAR;
- X EADJDIP(nation,country);
- X for( i=1; i<=NTOTAL; i++ )
- X if(ntn[i].dstatus[nation]==TREATY){
- X ntn[i].dstatus[country]=WAR;
- X EADJDIP(i,country);
- X mailopen(country);
- X fprintf(fm,"Message to %s from %s\n",ntn[country].name,ntn[i].name);
- X switch( rand()%4 ) {
- X case 0: fprintf(fm,"You just attacked my friend %s - your loss!!!\n",ntn[nation].name);
- X break;
- X case 1: fprintf(fm,"Our imperial forces will assist %s!!!\n",ntn[nation].name);
- X fprintf(fm,"in repulsing your toy armies!!!\n");
- X break;
- X case 2: fprintf(fm,"Sucker - your aggression against %s is your doom!!!\n",ntn[nation].name);
- X break;
- X case 3: fprintf(fm,"We deplore your aggression against %s and are taking\n",ntn[nation].name);
- X fprintf(fm,"appropriate counter measures!!! DIE!!!\n");
- X break;
- X }
- X mailclose();
- X }
- X }
- X }
- X }
- X}
- X
- Xint terror_adj=0;
- Xvoid
- Xchange()
- X{
- X float temp;
- X char string[10], command[80];
- X int i, intval;
- X long cost,men;
- X short armynum;
- X char passwd[PASSLTH+1];
- X short isgod=FALSE;
- X FILE *fp;
- X#ifdef OGOD
- X FILE *ftmp;
- X#endif OGOD
- X char filename[80];
- X
- X if(country==0) {
- X isgod=TRUE;
- X if (get_god()) return;
- X }
- X fp=fopen("temp","w");
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X clear();
- X standout();
- X mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY");
- X mvprintw(3,0,"nation name is %s",curntn->name);
- X mvprintw(4,0,"allignment is %s",allignment[npctype(curntn->active)]);
- X if (isgod==TRUE)
- X mvprintw(5,0,"active is %d",curntn->active);
- X mvprintw(6,0,"tax_rate...... %2d%%",curntn->tax_rate);
- X mvprintw(7,0,"inflation..... %2d%%",curntn->inflation);
- X i=10*curntn->tax_rate-curntn->popularity-curntn->terror-3*curntn->charity;
- X if( i<0 ) i=0;
- X mvprintw(8,0,"peasant revolt %2d%%",(i*PREVOLT)/100);
- X i=5*curntn->tax_rate - curntn->prestige;
- X if( i<0 ) i=0;
- X mvprintw(9,0,"other revolt.. %2d%%",(i*PREVOLT)/100);
- X standend();
- X mvprintw(10,0,"capitol loc: x is %d",curntn->capx);
- X mvprintw(11,0," y is %d",curntn->capy);
- X mvprintw(12,0,"leader is %s",curntn->leader);
- X mvprintw(13,0,"class is %s",*(Class+curntn->class));
- X if(ispc( curntn->active ) )
- X addstr(" (PC)");
- X else if(isnpc( curntn->active ) )
- X addstr(" (NPC)");
- X else addstr(" (MON)");
- X mvprintw(14,0,"nations mark is...%c ",curntn->mark);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X for(i=1;i<8;i++) if(curntn->race==*(races+i)[0]){
- X mvprintw(15,0, "nation race is....%s ",*(races+i));
- X break;
- X }
- X
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X mvprintw(3,COLS/2-12, "terror........ %3d",curntn->terror);
- X mvprintw(4,COLS/2-12, "popularity.... %3d",curntn->popularity);
- X mvprintw(5,COLS/2-12, "prestige...... %3d",curntn->prestige);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X fflush( fp );
- X mvprintw(6,COLS/2-12, "knowledge..... %3d",curntn->knowledge);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X fflush( fp );
- X temp = P_EATRATE;
- X mvprintw(7,COLS/2-12, "eatrate.......%3.2f",temp);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X fflush( fp );
- X mvprintw(8,COLS/2-12, "wealth........ %3d",curntn->wealth);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X fflush( fp );
- X mvprintw(9,COLS/2-12,"charity....... %2d%%",curntn->charity);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X fflush( fp );
- X mvprintw(10,COLS/2-12,"communication.%3.2f",(float) P_NTNCOM);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X mvprintw(11,COLS/2-12,"reputation.... %3d",curntn->reputation);
- X mvprintw(12,COLS/2-12,"spoilrate.....%3d%%",curntn->spoilrate);
- X mvprintw(13,COLS/2-12,"farm ability.. %3d",curntn->farm_ability);
- X mvprintw(14,COLS/2-12,"mine ability.. %3d",curntn->mine_ability);
- X mvprintw(15,COLS/2-12,"poverty rate.. %2d%%",curntn->poverty);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X mvprintw(16,COLS/2-12,"power......... %3d",curntn->power);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X
- X if (country!=0) {
- X mvprintw(16,0,"score currently...%ld",curntn->score);
- X mvprintw(3,COLS-30, "attack bonus.........%+4d%%",curntn->aplus);
- X mvprintw(4,COLS-30, "defense bonus........%+4d%%",curntn->dplus);
- X mvprintw(12,COLS-30,"total soldiers....%8ld",curntn->tmil);
- X } else {
- X mvprintw(16,0,"turn currently....%ld",TURN);
- X mvprintw(3,COLS-30, "mercs attack bonus....+%2d%%",MERCATT);
- X mvprintw(4,COLS-30, "mercs defense bonus...+%2d%%",MERCDEF);
- X mvprintw(12,COLS-30,"total mercs.......%8ld",MERCMEN);
- X }
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X
- X mvprintw(5,COLS-30, "maximum move rate.......%2d",curntn->maxmove);
- X mvprintw(6,COLS-30, "reproduction rate......%2d%%",curntn->repro);
- X mvprintw(8,COLS-30, "gold talons......$%8ld",curntn->tgold);
- X
- X mvprintw(9,COLS-30,"jewels ..........$%8ld",curntn->jewels);
- X mvprintw(10,COLS-30,"metal & minerals..%8ld",curntn->metals);
- X fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
- X if(curntn->tfood<2*curntn->tciv) standout();
- X mvprintw(11,COLS-30,"food in granary...%8ld",curntn->tfood);
- X standend();
- X
- X mvprintw(13,COLS-30,"total civilians...%8ld",curntn->tciv);
- X mvprintw(14,COLS-30,"total ships..........%5d",curntn->tships);
- X mvprintw(15,COLS-30,"total sectors........%5d",curntn->tsctrs);
- X mvprintw(16,COLS-30,"spell points.........%5d",curntn->spellpts);
- X
- X standout();
- X mvaddstr(LINES-6,COLS/2-26,"HIT 'B' FOR BUDGET SCREEN, 'P' FOR PRODUCTION SCREEN");
- X mvaddstr(LINES-5,COLS/2-25,"1) NAME 2) PASSWD 3) TAX RATE 4) CHARITY 5) TERROR");
- X if(magic(country,VAMPIRE)!=1)
- X mvaddstr(LINES-4,COLS/2-21,"6) ADD TO COMBAT BONUS");
- X else mvaddstr(LINES-4,COLS/2-22,"CANT ADD TO COMBAT BONUS");
- X addstr(" 7) TOGGLE PC <-> NPC");
- X
- X#ifdef OGOD
- X if(isgod==TRUE) mvaddstr(LINES-3,COLS/2-24,"HIT 8 TO DESTROY NATION OR 9 TO CHANGE COMMODITY");
- X#else OGOD
- X if(isgod==TRUE) mvaddstr(LINES-3,COLS/2-11,"HIT 8 TO DESTROY NATION");
- X#endif OGOD
- X else mvaddstr(LINES-3,COLS/2-14,"HIT ANY OTHER KEY TO CONTINUE");
- X standend();
- X refresh();
- X switch(getch()){
- X case '1': /*get name*/
- X clear();
- X mvaddstr(0,0,"what name would you like:");
- X clrtoeol();
- X refresh();
- X get_nname(string);
- X if((strlen(string)<=1)||(strlen(string)>NAMELTH)){
- X errormsg("invalid name");
- X if(isgod==TRUE) reset_god();
- X return;
- X }
- X /*check if already used*/
- X else for(i=1;i<(country-1);i++){
- X if((strcmp(ntn[i].name,string)==0)&&(i!=country)) {
- X errormsg("name already used");
- X if(isgod==TRUE) reset_god();
- X fclose(fp); return;
- X }
- X }
- X errormsg("new name can be used following next update");
- X strcpy(curntn->name,string);
- X ECHGNAME;
- X break;
- X case '2': /*change password */
- X clear();
- X if(isgod!=TRUE){
- X mvaddstr(0,0,"what is your current password:");
- X refresh();
- X gets(command);
- X strncpy(passwd,crypt(command,SALT),PASSLTH);
- X if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)
- X &&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){
- X errormsg("invalid password");
- X fclose(fp); return;
- X }
- X }
- X mvaddstr(2,0,"what is your new password:");
- X refresh();
- X gets(command);
- X if((strlen(command)>PASSLTH)||(strlen(command)<2)) {
- X errormsg("invalid new password");
- X if(isgod==TRUE) reset_god();
- X fclose(fp); return;
- X }
- X strncpy(passwd,command,PASSLTH);
- X mvaddstr(4,0,"reenter your new password:");
- X refresh();
- X gets(command);
- X if(strncmp(passwd,command,PASSLTH)!=0) {
- X if(isgod==TRUE) reset_god();
- X fclose(fp); return;
- X }
- X errormsg("new password can be used following next update");
- X strncpy(curntn->passwd,crypt(command,SALT),PASSLTH);
- X ECHGPAS;
- X break;
- X case '3': /* change tax rate */
- X standout();
- X mvaddstr(LINES-1,0,"WHAT TAX RATE DO YOU WISH:");
- X standend();
- X refresh();
- X intval = get_number();
- X if( intval < 0 )
- X errormsg("ERROR - negative tax rate");
- X else if( intval > 20 )
- X errormsg("NO WAY! the peasants will revolt!!!");
- X else if( intval > 10 && (curntn->tsctrs<20 || curntn->score<20) )
- X errormsg("Sorry, you may not go above 10% yet");
- X else {
- X curntn->tax_rate = (unsigned char) intval;
- X NADJNTN;
- X }
- X break;
- X case '4': /* charity */
- X standout();
- X mvaddstr(LINES-1,0,"GIVE WHAT PERCENT OF YOUR INCOME TO THE POOR:");
- X standend();
- X refresh();
- X intval = get_number();
- X if(( intval < 0 ) ||( intval > 100 ))
- X errormsg("ERROR - invalid charity rate");
- X /* this will protect from both underflow and overflow */
- X else if((int)curntn->popularity + 2*(intval - (int)curntn->charity)>100)
- X errormsg("ERROR - you may not increase charity that much");
- X else if((int)curntn->popularity + 2*(intval - (int)curntn->charity)<0)
- X errormsg("ERROR - you may not decrease charity that much");
- X else {
- X curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity);
- X curntn->charity = intval;
- X NADJNTN;
- X }
- X break;
- X case '5': /* terror */
- X mvaddstr(LINES-2,0,"YOU CAN TERRORIZE YOUR PEOPLE AN ADDITONAL 1-5%:");
- X standout();
- X mvaddstr(LINES-1,0,"HOW MUCH MORE TO TERRORIZE THEM: ");
- X standend();
- X refresh();
- X intval = get_number();
- X if( intval < 0 )
- X errormsg("ERROR - negative input");
- X else if( intval+curntn->terror > 100 )
- X errormsg("Cant go over 100 terror!!!");
- X else if((intval > curntn->popularity )
- X || (intval > curntn->reputation ))
- X errormsg("Sorry - this would cause underflow");
- X else if(intval>5) {
- X errormsg("That is over the allowed 5%");
- X } else if(terror_adj>0) {
- X errormsg("Terror may only be adjusted once per turn");
- X } else if(intval>0) {
- X terror_adj++;
- X curntn->terror += (unsigned char) intval;
- X curntn->popularity -= (unsigned char) intval;
- X curntn->reputation -= (unsigned char) (intval+1)/2;
- X NADJNTN2;
- X }
- X break;
- X case '6': /* combat bonus */
- X if(magic(country,VAMPIRE)==1) {
- X errormsg("VAMPIRES CAN'T ADD TO COMBAT BONUS");
- X break;
- X }
- X if(magic(country,WARLORD)==1) intval=30;
- X else if(magic(country,CAPTAIN)==1) intval=20;
- X else if(magic(country,WARRIOR)==1) intval=10;
- X else intval=0;
- X men=0;
- X for(armynum=0;armynum<MAXARM;armynum++)
- X if((P_ASOLD>0)&&(P_ATYPE<MINLEADER)) men+=P_ASOLD;
- X men = max( men, 1500);
- X armynum = max( curntn->aplus-intval, 10 );
- X cost = METALORE*men*armynum*armynum/100;
- X if( curntn->race == ORC) cost*=3;
- X mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Attack (enter y or n):",cost);
- X refresh();
- X if(getch()=='y'){
- X if(curntn->metals> cost){
- X curntn->aplus+=1;
- X I_APLUS;
- X curntn->metals-=cost;
- X } else {
- X errormsg("SORRY");
- X }
- X }
- X armynum = max( curntn->dplus-intval, 10 ) / 10;
- X cost=METALORE*men*armynum*armynum;
- X if( curntn->race == ORC) cost*=3;
- X mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Defense (enter y or n):",cost);
- X refresh();
- X if(getch()=='y'){
- X if(curntn->metals>cost){
- X curntn->dplus+=1;
- X I_DPLUS;
- X curntn->metals-=cost;
- X } else {
- X errormsg("SORRY");
- X }
- X }
- X break;
- X case '7':
- X if( startgold != curntn->tgold ) {
- X errormsg("Sorry: you have already made some moves this turn!");
- X break;
- X } else if(ispc(curntn->active)) {
- X errormsg("Note: you get no mail while playing as an NPC!");
- X curntn->active *= 4;
- X } else if(isnpc(curntn->active))
- X curntn->active /= 4;
- X NADJNTN;
- X break;
- X case '8':
- X if(isgod==TRUE){
- X clear();
- X mvaddstr(LINES-1,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
- X refresh();
- X
- X if(getch()=='y') {
- X /* save to last turns news file */
- X sprintf(filename,"%s%d",newsfile,TURN-1);
- X if ((fnews=fopen(filename,"a+"))==NULL) {
- X printf("error opening news file\n");
- X exit(FAIL);
- X }
- X destroy(country);
- X fclose(fnews);
- X sprintf(command,"%s/%s",DEFAULTDIR, sortname);
- X sprintf(command,"%s %s %s", command, filename, filename);
- X system(command);
- X }
- X }
- X break;
- X#ifdef OGOD
- X case '9':
- X if (isgod==TRUE) {
- X /* open the target country's files */
- X sprintf(filename,"%s%d",exefile,country);
- X if ((ftmp=fopen(filename,"a"))==NULL) {
- X beep();
- X errormsg("error opening country's file");
- X reset_god();
- X fclose(fp); return;
- X }
- X /* adjust commodities */
- X mvaddstr(LINES-2,0,"CHANGE: 1) Gold 2) Jewels 3) Iron 4) Food ?");
- X clrtoeol();
- X refresh();
- X switch(getch()) {
- X case '1':
- X mvaddstr(LINES-1,0,"WHAT IS NEW VALUE FOR TREASURY? ");
- X refresh();
- X curntn->tgold = (long) get_number();
- X fprintf(ftmp,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNAGOLD ,country,curntn->tgold,"null");
- X break;
- X case '2':
- X mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF JEWELS? ");
- X refresh();
- X curntn->jewels = (long) get_number();
- X fprintf(ftmp,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNARGOLD ,country,curntn->jewels,"null");
- X break;
- X case '3':
- X mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF METAL? ");
- X refresh();
- X curntn->metals = (long) get_number();
- X fprintf(ftmp,"L_NMETAL\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNAMETAL ,country,curntn->metals,"null");
- X break;
- X case '4':
- X mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF FOOD? ");
- X refresh();
- X curntn->tfood = (long) get_number();
- X break;
- X default:
- X break;
- X }
- X fclose(ftmp);
- X }
- X break;
- X#endif OGOD
- X case 'p':
- X case 'P': produce(); fclose(fp); return;
- X case 'b':
- X case 'B': budget(); fclose(fp); return;
- X default:
- X if(isgod==TRUE) reset_god();
- X fclose(fp);
- X return;
- X }
- X if(isgod==TRUE) reset_god();
- X fclose(fp);
- X change();
- X}
- X
- Xvoid
- Xhelp()
- X{
- X int lineno;
- X FILE *fp, *fopen();
- X int i,xcnt,ycnt,done=FALSE;
- X char line[80],fname[80];
- X
- X /*find out which helpfile to read in */
- X clear_bottom(0);
- X ycnt = LINES - 3;
- X xcnt = 0;
- X mvaddstr(LINES-4,0,"Help on which topic:");
- X for (i=0;i<MAXHELP;i++) {
- X sprintf(line," %d) %s",i,helplist[i]);
- X mvaddstr(ycnt,xcnt,line);
- X xcnt += 20;
- X if (i==2) {
- X xcnt = 0;
- X ycnt ++;
- X }
- X }
- X refresh();
- X i = getch()-'0';
- X
- X /* quick exit on invalid entry */
- X if (i<0 || i>MAXHELP) {
- X redraw=FALSE;
- X makebottom();
- X return;
- X }
- X
- X /*open help file*/
- X sprintf(fname,"%s/%s%d",DEFAULTDIR,helpfile,i);
- X if ((fp=fopen(fname,"r"))==NULL) {
- X mvprintw(0,0,"\nerror on read of %s\n",fname);
- X refresh();
- X getch();
- X return;
- X }
- X
- X while(done==FALSE){
- X /*read in screen (until DONE statement)*/
- X fgets(line,80,fp);
- X if(strncmp(line,"DONE",4)==0) done=TRUE;
- X else {
- X clear();
- X lineno=0;
- X while(strncmp(line,"END",3)!=0) {
- X if(lineno==0) {
- X /* highlight topic line */
- X for(i=0;line[i]==' ';i++) ;
- X i--; /* back up 1 */
- X standout();
- X mvaddstr(lineno,i,line+i);
- X /* add a blank space on the end */
- X mvaddch(lineno,strlen(line)-1,' ');
- X standend();
- X } else mvaddstr(lineno,0,line);
- X lineno++;
- X if(lineno>LINES-3) strcpy(line,"END");
- X else fgets(line,80,fp);
- X }
- X standout();
- X /* help screen 80 col format; constants needed */
- X mvaddstr(LINES-2,16,"HIT ANY KEY TO CONTINUE HELP SCREENS");
- X mvaddstr(LINES-1,21,"TO END HELP HIT SPACE KEY");
- X standend();
- X refresh();
- X if(getch()==' ') done=TRUE;
- X }
- X }
- X fclose(fp);
- X}
- X
- Xvoid
- Xnewspaper()
- X{
- X int lineno;
- X FILE *fp, *fopen();
- X int newpage,choice,done=FALSE;
- X short pagenum=1;
- X int i,ydist,xdist;
- X char line[80],name[80];
- X
- X /* check to make sure that there are newspapers */
- X if (TURN==0) {
- X clear_bottom(0);
- X errormsg("no news to read");
- X redraw=FALSE;
- X makebottom();
- X return;
- X }
- X
- X clear_bottom(0);
- X ydist=LINES-3;
- X xdist=0;
- X /* check for all newspapers up until the current turn */
- X for (i=TURN-1;i>=0 && i>=TURN-MAXNEWS;i--) {
- X sprintf(line," %d) %s of Year %d",TURN-i,
- X PSEASON(i), YEAR(i));
- X /* align all strings */
- X mvprintw(ydist,xdist,"%s",line);
- X xdist += strlen(line);
- X if (xdist>60) {
- X xdist=0;
- X ydist++;
- X }
- X }
- X mvaddstr(LINES-4,0,"Read Which Newspaper:");
- X standend();
- X refresh();
- X /* get the choice */
- X choice = getch() - '0';
- X /* make sure the choice is valid */
- X if (choice<1 || choice > MAXNEWS) {
- X makebottom();
- X redraw=FALSE;
- X return;
- X }
- X
- X sprintf(name,"%s%d",newsfile,TURN-choice);
- X if ((fp=fopen(name,"r"))==NULL) {
- X clear_bottom(0);
- X sprintf(line,"unable to open news file <%s>",name);
- X errormsg(line);
- X redraw=FALSE;
- X makebottom();
- X return;
- X }
- X
- X /*open and read one page */
- X newpage=FALSE;
- X line[0]='\0';
- X strcpy(name,"");
- X
- X /*clear out any proceeding blanks*/
- X while(done==FALSE && strlen(name)==0)
- X if(fgets(name,80,fp)==NULL) done=TRUE;
- X
- X while(done==FALSE){
- X if(newpage==FALSE){
- X clear();
- X lineno=5;
- X newpage=TRUE;
- X standout();
- X mvprintw(0,23,"CONQUER NEWS REPORT page %d",pagenum);
- X mvprintw(1,28,"%s of Year %d",PSEASON(TURN-choice),YEAR(TURN-choice));
- X mvprintw(3,37-strlen(name)/2,"%s",name+2);
- X standend();
- X /* display any pending non-blank lines */
- X if(strcmp(line,name)!=0 && strlen(line)>2)
- X mvaddstr(lineno++,0,line+2);
- X } else if(fgets(line,80,fp)==NULL) done=TRUE;
- X else {
- X if(line[1]!='.') {
- X strcpy(name,line);
- X newpage=FALSE;
- X pagenum++;
- X } else {
- X if(todigit(line[0])!=pagenum) {
- X newpage=FALSE;
- X pagenum=todigit(line[0]);
- X }
- X else if(lineno>LINES-4) newpage=FALSE;
- X else if(strlen(line)>2) mvaddstr(lineno++,0,line+2);
- X }
- X }
- X if(newpage==FALSE||done==TRUE){
- X standout();
- X /* constants since news is 80 col format */
- X mvaddstr(LINES-2,24,"HIT ANY KEY TO CONTINUE");
- X mvaddstr(LINES-1,25,"TO END NEWS HIT SPACE");
- X standend();
- X refresh();
- X if(getch()==' ') done=TRUE;
- X }
- X }
- X fclose(fp);
- X}
- END_OF_FILE
- if test 26241 -ne `wc -c <'forms.c'`; then
- echo shar: \"'forms.c'\" unpacked with wrong size!
- fi
- # end of 'forms.c'
- fi
- if test -f 'header.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'header.h'\"
- else
- echo shar: Extracting \"'header.h'\" \(8357 characters\)
- sed "s/^X//" >'header.h' <<'END_OF_FILE'
- X/* conquer : Copyright (c) 1988, 1989 by Ed Barlow.
- X
- X MODIFICATION OF THIS FILE IMPLIES THAT THE MODIFIER WILL ACCEPT
- X A LIMITED USE COPYRIGHT AS FOLLOWS:
- X
- X 1) This software is copyrighted and protected by law. The
- X sole owner of this software, which hereafter is known as
- X "conquer" is Edward M. Barlow, who hereby grants you a
- X personal, non-exclusive right to use this software.
- X All rights on this software are reserved.
- X 2) conquer may not be redistributed in any form. Any requests for
- X new software shall, for now, be the perogative of the author.
- X 3) loss or damage caused by this software shall not be
- X the responsibility of the author.
- X 4) Ed Barlow shall be notified of enhancements to this software via
- X electronic mail and, if there is no response, via US mail to:
- X
- X Ed Barlow
- X 562 Clubhouse Dr,
- X Middletown NJ 07748
- X
- X My home phone is 201-671-2896. Use it sparingly and call
- X before 11PM if it is important.
- X 5) no attempt shall be made to make any money from this game or to
- X use any portion of this code to make any money without the
- X authors permission.
- X 6) no attempt shall be made to port this software to any form of
- X personal computer without the permission of Ed Barlow.
- X 7) you agree to use your best efforts to see that any user
- X of conquer complies with the terms and conditions stated above.
- X 8) The above copyright agreement will not be tampered with in any form.
- X
- X
- X Special thanks to Brian Beuning, Adam Bryant, and any others who helped
- X me by making enhancements and bug reports
- X*/
- X
- X/* --- MODIFICATION IS REQUIRED OF THE FOLLOWING DEFINE STATEMENTS --- */
- X#define OWNER "Ed Barlow" /* administrators name */
- X#define LOGIN "smile" /* administrators login id. IMPORTANT! */
- X /* only this UID may update. */
- X#define SYSV /* uncomment this line on a UNIX SYSV machine */
- X/* #define BSD /* uncomment this line on a BSD machine */
- X/* #define HPUX /* uncomment for HP-UNIX */
- X/* #define SYSMAIL /* if your system supports mail */
- X /* conquer will notify you about system mail */
- X
- X/* -------------------MODIFICATION IS OPTIONAL ON THE FOLLOWING------------- */
- X#define SPOOLDIR "/usr/spool/mail" /* location of mail spool */
- X/* #define FILELOCK /* if your system supports BSD flock() */
- X /* other file locking is not well implemented */
- X
- X#define NTOTAL 25 /* max # of nations ( player + npc + monster ) */
- X#define MAXPTS 65 /* points for players to buy stuff with at start*/
- X#define MAXARM 40 /* maximum number of armies per nation */
- X#define MAXNAVY 10 /* maximum number of fleets per nation */
- X#define PDEPLETE 30 /* % of armies/sectors depleted without Capitol */
- X#define PFINDSCOUT 50 /* percentage chance for capturing scouts */
- X
- X#define RUNSTOP /* defined to stop update if players are in */
- X /* game -- not recommended with automatic update*/
- X#define TRADE /* defined to allow commerce between nations */
- X#define TRADEPCT 75 /* percent of sectors with exotic trade goods */
- X#define METALPCT 33 /* percent of tradegoods that are metals */
- X#define JEWELPCT 33 /* percent of tradegoods that are luxury items */
- X#define HIDELOC /* defined if news is not to report sectors */
- X
- X#define OGOD /* defined if you wish to enhance god powers. This
- X should not be defined on the pc as there is no
- X /etc/passwd file to read info from */
- X
- X#define DERVDESG /* allow DERVISH to redesignate in a DESERT/ICE */
- X#define MONSTER 45 /* defined if pirates/barbarians/nomads/lzard exist.
- X represents # of sectors of land that need to be
- X in world per pirate/barbarian/nomad nation */
- X#define CHEAT /* npcs will cheat to keep up - this is a very weak
- X form of cheating. I use good npc algorithms
- X (i think... comments) */
- X#define STORMS /* have storms strike fleets */
- X#define VULCANIZE /* add in volcano eruptions.... */
- X#define PVULCAN 20 /* % chance of eruption each round (see above) */
- X#define ORCTAKE 100000L /* comment out if dont want orcs to takeover orc
- X NPCs. else is takeover price in jewels */
- X#define MOVECOST 20l /* cost to do a move, get a screen... */
- X#define TAKEPOINTS 10 /* spell points for orc takeover */
- X#define PMOUNT 40 /* % of land that is mountains */
- X#define PSTORM 3 /* % chance that a storm will strike a fleet */
- X /* unless it is in harbor */
- X#define NPC /* defined if non player country exists at start*/
- X#define CMOVE /* Defined if you wish the computer to move
- X for Player nations if they forget to move */
- X#define BEEP /* defined if you wish terminal to beep */
- X#define HILIGHT /* defined if terminals support inverse video */
- X#define RANEVENT 15 /* comment out if you dont want random events
- X weather, tax revolts, and volcanoes all are
- X considered random events. */
- X#define PWEATHER 0 /* percent for weather disaster - unimplemented */
- X#define PREVOLT 25 /* %/turn that a revolt acutally occurs */
- X /* a turn is 1 season and 25% is a large value */
- X#define SPEW /* spew random messages from npcs */
- X
- X/* ---BELOW THIS POINT ARE PARAMETERS YOU MIGHT OPTIONALLY WISH TO CHANGE--- */
- X
- X/* making these numbers large takes more CPU time */
- X#define LANDSEE 2 /* how far you can see from your land */
- X#define NAVYSEE 1 /* how far navies can see */
- X#define ARMYSEE 2 /* how far armies can see */
- X#define PRTZONE 3 /* how far pirates roam from their basecamp */
- X#define MEETNTN 2 /* how close nations must be to adjust status */
- X
- X/* Below taxation rates are in gold talons per unit of product produced */
- X#define TAXFOOD 5L
- X#define TAXMETAL 8L
- X#define TAXGOLD 8L
- X#define TAXOTHR 3L /* per food point equivalent */
- X/* Town and City/Capitol tax rates based on # of people */
- X#define TAXCITY 100L
- X#define TAXTOWN 80L
- X
- X#define SHIPMAINT 4000L /* ship mainatinance cost */
- X#define TOMANYPEOPLE 4000L /* too many people in sector - 1/2 repro and
- X 1/2 production; not in cities/caps */
- X#define ABSMAXPEOPLE 50000L /* absolute max people in any sector */
- X#define MILLSIZE 500L /* min number of people to work a mill */
- X#define TOMUCHMINED 50000L /* units mined for 100% chance of metal */
- X /* depletion actual chance is prorated */
- X#define DESFOOD 4 /* min food val to redesignate sector */
- X#define MAXNEWS 5 /* number of news files stored */
- X#define LONGTRIP 100 /* navy trip lth for 100% attrition */
- X
- X/* min soldiers to take sector - either 75 or based on your civilians */
- X#define TAKESECTOR max(75,(ntn[country].tciv/350))
- X
- X#define MAXLOSS 60 /* maximum % of men lost in 1:1 battle */
- X#define FINDPERCENT 1 /* percent to find gold/metal in sector */
- X#define DESCOST 2000L /* cost to redesignate and the metal cost
- X for cities */
- X#define FORTCOST 1000L /* cost to build a fort point */
- X#define STOCKCOST 3000L /* cost to build a stockade */
- X#define WARSHPCOST 20000L /* cost to build one light warship */
- X#define MERSHPCOST 25000L /* cost to build one light merchant */
- X#define GALSHPCOST 25000L /* cost to build one light galley */
- X#define SHIPCREW 100 /* full strength crew on a ship */
- X#define SHIPHOLD 100L /* storage space of a ship unit */
- X#define CITYLIMIT 8L /* % of npc pop in sctr before => city */
- X#define CITYPERCENT 20L /* % of npc pop able to be in cities */
- X/* note that militia are not considered military below */
- X#define MILRATIO 8L /* ratio civ:mil for NPCs */
- X#define MILINCAP 8L /* ratio (mil in cap):mil for NPCs */
- X#define MILINCITY 10L /* militia=people/MILINCITY in city/cap */
- X#define NPCTOOFAR 15 /* npcs should not go this far from cap */
- X#define BRIBE 50000L /* amount of gold/1000 men to bribe */
- X#define METALORE 7L /* metal/soldier needed for +1% weapons */
- X/* strength value for fortifications */
- X#define DEF_BASE 10 /* base defense value 2 * in city/caps */
- X#define FORTSTR 5 /* percent per fortress point in forts */
- X#define TOWNSTR 5 /* percent per fortress point in towns */
- X#define CITYSTR 8 /* percent per fortress point in city */
- X#define LATESTART 2 /* new player gets 1 point/LATESTART turns,
- X when they start late into the game */
- X
- X/* starting values for mercenaries */
- X#define ST_MMEN (NTOTAL*500) /* a nation may draft ST_MMEN/NTOTAL */
- X /* mercenaries per turn. Added to when */
- X /* armies are disbanded. */
- X#define ST_MATT 40 /* mercenary attack bonus */
- X#define ST_MDEF 40 /* mercenary defense bonus */
- X
- X#define VERSION "Version 4" /* version number of the game */
- END_OF_FILE
- if test 8357 -ne `wc -c <'header.h'`; then
- echo shar: \"'header.h'\" unpacked with wrong size!
- fi
- # end of 'header.h'
- fi
- if test -f 'txt0' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'txt0'\"
- else
- echo shar: Extracting \"'txt0'\" \(8644 characters\)
- sed "s/^X//" >'txt0' <<'END_OF_FILE'
- X CONQUER COMMAND HELP SCREEN
- X
- X MOVEMENT COMMANDS ADMINISTRATION
- X'h': move west 'a': army report 'p': pick item
- X'y': move north-west 'r': redesignate 'd': change display
- X'k': move north 'w': cast spells/summon 'c': administration
- X'u': move north-east 'm': move selected unit '?': help screen
- X'l': move east 'F': go to next fleet 's': score
- X'n': move south-east 'f': fleet report 'B': budget status
- X'j': move south 'Z': move people 2 Sectors 'P': production stats
- X'b': move south-west 'S': diplomacy status 'N': read newspaper
- X'J': scroll south 'Q': quit (saves changes) 'W': write message
- X'K': scroll north 'M': magic 'R': read messages
- X'L': scroll east 'C': construct 'T': trade
- X'H': scroll west 'D': draft 't': transport via ship
- X 'G': go to next army 'v': version credits
- X 'g': group army report 'I': campaign information
- X'ctrl-L': redraw 'ESC': extra commands
- XEND
- X CONQUER EXTENDED COMMANDS
- X
- X All of the extended commands are accessed by typing the ESC key and
- Xthen one of the following extended command keys.
- X
- X Each of the commands takes action on the currently selected army unit.
- X
- X 'a': set army status to ATTACK
- X 'd': set army status to DEFEND
- X 's': set army status to SCOUT
- X 'm': set army status to MARCH
- X 'g': set army status to GARRISON
- X 'G': place army in a group with other armies
- X 'S': set army status to SEIGE or SORTIE
- X 'R': set army leader status to RULE
- X '+': combine selected and next army
- X '-': separate army into two units
- X '/': separate army into two equal units
- XEND
- X Welcome to Conquer XVERSION
- X
- XCONQUER is a multi player computer game designed to run under the UNIX
- Xoperating system. In CONQUER, each player is the leader of a nation,
- Xcomposed of people (humans, orcs, elves, dwarves), resources, and land.
- XRulers customize their nation at creation by chosing their race and by giving
- Xtheir nation special powers (magic, combat factor, location, speed...)
- Xand resources (civilians, troops, metal, gold...). Play involves building,
- Xmoving, and controlling armies and navies, diplomacy with other players,
- Xand adjusting economic activity, which is primarily geared to the production
- Xof gold for your treasury. Metals are needed, however to build ships & armies,
- Xand food is needed to prevent revolts and keep people alive.
- X
- XCommand line format: conquer [-hs -nNAT -dDIR]
- X -h print this help text
- X -s print out scores
- X -n NTN run as nation NTN
- X -d DIR run on data in directory DIR
- XIt is suggested that each player set up a shell alias for their game & nation
- XThe game administrator should read documentation on using the conqrun command.
- XEND
- X CONQUER CURSOR MOVEMENT
- X
- X NORTH
- X
- X (K)
- X y,7 k,8 u,9
- X \ | /
- X \ | /
- X WEST (H) h,4 ---- 0 ---- l,6 (L) EAST
- X / | \
- X / | \
- X b,1 j,2 n,3
- X (J)
- X
- X SOUTH
- X
- X Figures in parenthesis indicate scrolling
- X Note either numeric keypad OR vi keys can be used
- X
- X <cntrl>-L will redraw the screen
- XEND
- X CONQUER COMMANDS -- lower case commands
- X
- X'a': army report: Gives an army's details & permits changing army status,
- X merging 2 armies, splitting armies, and disbanding armies
- X'c': administration: Report on nation status and then change name, password,
- X add to combat bonus, or (if god) destroy a nation.
- X'd': change display: Change display mode. metal/jewel screens #'s are sector
- X value. Population screen #'s are the closest 100 people
- X'f': fleet report: Report on the status of your fleets.
- X'g': group report: As army report, but only show armies in current sector.
- X'm': move unit: move selected unit. The unit will stop when it runs out
- X of move points or runs into an army larger than it.
- X'p': pick item: allows you to select the next army or navy in the
- X sector. Other commands will operate on that unit.
- X'r': redesignate: you can change habitable sectors you own to other
- X designations. Towns require 500+ people & Capitols
- X require Towns. God can redesignate anything.
- X's': score: print out a screen showing the scores
- X't': transport: load/unload soldiers or civilians onto selected fleet.
- X'w': wizardry: cast spells if you have the ability
- X'?': help screen: print out this help text
- XEND
- X CONQUER COMMANDS -- upper case commands pg. 1.
- X
- X'B': budget : ESTIMATE your nations budget statistics
- X'C': construct: If you have cash, you can build fortifications and
- X ships in your Towns. Ships can only be built in Towns
- X located on the water.
- X'D': draft: You may draft a 1/4 of the starting sector population if it
- X was a Town/City/Cap and if you have the gold & metal. You
- X must draft soldiers in multiples of 10 men.
- X'F': next fleet: Move cursor to your next fleet.
- X'G': next army: Move cursor to your next army.
- X'I': information: Display a screen containing general conquer statistics.
- X'M': magic: Prints your magic powers & offers you the option to
- X purchase more (cost doubles each power). Monster Power
- X gives you the chance to take over NPC nations.
- XEND
- X CONQUER COMMANDS -- upper case commands pg. 2.
- X
- X'N': newspaper: Briefs you on world happenings. Note: News has 4 pages.
- X'P': production: ESTIMATE your nations production statistics
- X'S': diplomacy: Allow you to see and alter your diplomatic status.
- X'T': commerce: Allow you to trade with other nations.
- X'Q': quit: Save your move and quit the game. Note there is no
- X means supported to quit without saving your moves.
- X'R': read mail: Read mail messages
- X'W': write mail: Write mail messages. You can write to the administrator
- X and can post articles to the news board with this command.
- X'Z': move people: Civilians can move between two of your sectors at a cost
- X of 50 per civilian. Civilians naturally move in the update.
- XEND
- X A TYPICAL FIRST TURN
- X
- XThis section is offered to help beginning players understand the first
- Xturns of the game. The objective at this point is to take land and to
- Xmake enough farms that your people don't starve. The first thing to do is
- Xto look at sectors you can see (using the cursor keys). You
- Xare looking for sectors with high (4+) food/metal/jewel values. You should
- Xnow assign soldiers to army groups (via. the Escape / G sequence). An army
- Xgroup id is the same as a leader id. Then, pick an army or army group with
- Xthe 'p'ick command and 'm'ove it to a target sectors. When you stop the
- Xarmy, it should take the sector, and you should be able to see a little bit
- Xmore of the world. Every army should try to take a different sector each
- Xof the first few turns. 'r'edesignate sectors to farms (f),mines (m), or
- Xgoldmines ($). Now browse the other reports and forms to get a feel of the
- Xgame. When done, quit via the 'q'uit command. After the update,
- Xcivilians will have moved into your sectors, and will start producing.
- XWatch that food consumption early on!!!
- XEND
- X FINAL COMMENTS
- X
- XTo my knowledge Conquer runs well on UNIX (SYS V or BSD 4.3) systems. The
- Xgame treats turns like a hidden move wargame would... you enter all your
- Xmoves and the program and the program tells you what happens. Like wargames,
- Xthere is no turning back. Every move you make will be saved when you quit.
- XIf you goof up real bad, you need to go to the administrator, and have him
- Xlog in (as god) and fix whatever you did.
- X
- XHave Fun
- X
- XThe Ed
- XEND
- XDONE
- END_OF_FILE
- if test 8644 -ne `wc -c <'txt0'`; then
- echo shar: \"'txt0'\" unpacked with wrong size!
- fi
- # end of 'txt0'
- fi
- echo shar: End of archive 13 \(of 14\).
- cp /dev/null ark13isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 14 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-